package com.wanghua.mall.search.webcontroller;

import com.wanghua.mall.search.service.MallSearchService;
import com.wanghua.mall.search.vo.SearchParam;
import com.wanghua.mall.search.vo.SearchResult;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;

/**
 * @author wanghua
 * @create 2021-08-29 14:20
 */
@Controller
public class SearchController {

    @Resource
    private MallSearchService mallSearchService;

    //检索页
    @GetMapping("/list.html")
    public String listPage(SearchParam searchParam, Model model) {
        SearchResult searchResult = mallSearchService.search(searchParam);
        model.addAttribute("result", searchResult);
        return "list";

    }
}
